package cn.qingyun.gis.modules.scenes.entity;

import cn.qingyun.gis.cache.handler.GeometryDeserializor;
import cn.qingyun.gis.cache.handler.GeometrySerializor;
import cn.qingyun.gis.modules.middle.handler.GeometryTypeHandler;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.locationtech.jts.geom.Geometry;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @Description: 区划（市场条线）数据表表实体对象
 * @Version: V1.0
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName(value = "uni_addr_region", schema = "sync", autoResultMap = true)
@ApiModel(value = "UniAddrRegion对象", description = "UniAddrRegion对象")
public class  UniAddrRegion implements Serializable {

    private static final long serialVersionUID = 1L;
    /**
     * ID
     */
    @ApiModelProperty(value = "ID")
    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    /**
     * 编码
     */
    @ApiModelProperty(value = "编码")
    @Excel(name = "编码", width = 15)
    private String code;

    /**
     * 父级编码
     */
    @ApiModelProperty(value = "父级编码")
    @Excel(name = "父级编码", width = 15)
    private String parentCode;

    /**
     * 名称
     */
    @ApiModelProperty(value = "名称")
    @Excel(name = "名称", width = 15)
    private String name;

    /**
     * 层级
     */
    @ApiModelProperty(value = "层级")
    @Excel(name = "层级", width = 15)
    private String parentName;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @Excel(name = "创建时间", width = 15)
    private Integer level;

    /**
     * 边界数据
     */
    @ApiModelProperty(value = "边界数据")
    @Excel(name = "边界数据", width = 15)
    @TableField(value = "wkt", typeHandler = GeometryTypeHandler.class)
    @JsonSerialize(using = GeometrySerializor.class)
    @JsonDeserialize(using = GeometryDeserializor.class)
    private Geometry wkt;

    /**
     * 中心点
     */
    @ApiModelProperty(value = "中心点")
    @Excel(name = "中心点", width = 15)
    @TableField(value = "center_point", typeHandler = GeometryTypeHandler.class)
    @JsonSerialize(using = GeometrySerializor.class)
    @JsonDeserialize(using = GeometryDeserializor.class)
    private Geometry centerPoint;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @Excel(name = "创建时间", width = 15)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @Excel(name = "更新时间", width = 15)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /**
     * 0 不变更 1 变更 2 新增 3 删除
     */
    @ApiModelProperty(value = "0 不变更 1 变更 2 新增 3 删除")
    @Excel(name = "0 不变更 1 变更 2 新增 3 删除", width = 15)
    private Integer state;

    /**
     * 中心点经度
     */
    @TableField(exist = false)
    private BigDecimal lon;

    /**
     * 中心点纬度
     */
    @TableField(exist = false)
    private BigDecimal lat;
}
